#!/usr/bin/env bash

## Copyright (C) 2020-2023 Aditya Shakya <adi1090x@gmail.com>
##
## Autostart Programs
## Edited for Garuda Linux by yurihikari

# Kill already running process
_ps=(waybar mako)
for _prs in "${_ps[@]}"; do
	if [[ `pidof ${_prs}` ]]; then
		killall -9 ${_prs}
	fi
done

# Start gnome keyring
exec gnome-keyring-daemon --daemonize --start --components=gpg,pkcs11,secrets,ssh &

# Polkit agent
# if [[ ! `pidof xfce-polkit` ]]; then
# 	/usr/lib/xfce-polkit/xfce-polkit &
# fi
exec /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 &

pipewire &
wireplumber &
# Set wallpaper
# swaybg --output '*' --mode fill --image ~/.config/backgrounds/march7.jpg &
swww-daemon &

# Apply themes
~/.config/hypr/scripts/gtkthemes &

# Lauch notification daemon (mako) Enable if not using AGS
~/.config/hypr/scripts/notifications &

# Lauch statusbar (waybar) Disable if using AGS
~/.config/hypr/scripts/statusbar &

# Start network manager applet
nm-applet --indicator &

# Start tuxedo-control-center Let it commented if not using Tuxedo
#tuxedo-control-center --tray &

# Start mpd
exec mpd &

# Start AGS Enable if not using Waybar
# For v1
#exec agsv1 &
# For v2
#exec hyprpanel &